//index.js
//获取应用实例
const app = getApp()
var provinceZHList= ['江苏省', '安徽省', '四川省'];
var provinceUSList = ['阿拉斯加州', '佛罗里达州', '加利福尼亚州'];
var provinceZHList = ['江苏省', '安徽省', '四川省'];
var cityJSList= ['南通市', '苏州市', '南京市'];
var cityAHList= ['合肥市', '芜湖市', '安庆市'];
var citySCList= ['成都市', '绵阳市', '自贡市'];

Page({
  data: {
    region: ["四川省", "广元市", "苍溪县"],
    countryList: ['中国', '美国', '英国'],
    countryIndex: 0,
    provinceIndex: 0,
    cityIndex: 0
  },
  // 选择省市区函数
  changeRegin(e) {
    this.setData({ region: e.detail.value });
  },
  changeCountry(e) {
    console.log(e.detail.value);
    if (e.detail.value=="0"){
      this.setData({ provinceList: provinceZHList });
    }
    this.setData({ countryIndex: e.detail.value });
  },
  changeProvince(e) {
    console.log(e.detail.value);
    if (e.detail.value == "0") {
      this.setData({ cityList: cityJSList });
    } else if (e.detail.value == "1") {
      this.setData({ cityList: cityAHList });
    } else if (e.detail.value == "2") {
      this.setData({ cityList: citySCList });
    }
    this.setData({ provinceIndex: e.detail.value });
  },
  changeCity(e) {
    console.log(e.detail.value);
    this.setData({ cityIndex: e.detail.value });
  },
  
  onLoad: function () {
    
  }
})
